package openbang.account.web.portal.client;

import java.util.List;

import openbang.account.service.entity.UserAccount;
import openbang.account.service.intf.AccountService;
import openbang.account.web.portal.widget.ViewUserList;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * 
 * 显示会员列表
 * 
 * @author aibozeng
 *
 */

public class ListMembers implements EntryPoint {
	final ViewUserList viewUserList = new ViewUserList();
	
	@Override
	public void onModuleLoad() {		
		RootPanel.get("listmember_div").add(viewUserList);
		AccountService.Util.getInstance().getAll(new AsyncCallback<List<UserAccount>>(){
			public void onFailure(Throwable caught) {
				//隐藏进度条
				RootPanel.get("loading").setVisible(false);
				Window.alert(caught.getMessage());
			}
			public void onSuccess(List<UserAccount> result) {
				//隐藏进度条
				RootPanel.get("loading").setVisible(false);
				if(result==null){
					Window.alert("没有会员");
					return;
				}
				viewUserList.initData(result);
			}
		});
	}
	
}
